package com.joinway.framework.extension.cipher;

import org.apache.commons.codec.digest.DigestUtils;

public final class MD5 {

	/**
	 * MD5单向加密
	 * @param text
	 * @return
	 */
	public static String encrypt(String text) {
		return DigestUtils.md5Hex(text);
	}

	/**
	 * MD5单向加密
	 * @param text
	 * @param salt
	 * @return
	 */
	public static String encrypt(String text, String salt) {
		String s = salt == null ? "" : salt.trim();
		return encrypt(encrypt(text) + s);
	}
	
	private MD5(){}
}
